package top.wshape1.shiziapi.uaa.utils;

import com.alibaba.fastjson2.JSON;
import jakarta.servlet.http.HttpServletResponse;
import top.wshape1.shiziapi.common.utils.R;

import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author Wshape1
 * @version 1.0
 * @description
 * @since 2023-08-24
 */

public class ResponseUtil {


    public static void writeResponse(HttpServletResponse response, R<?> r) throws IOException {
        response.setContentType("application/json;charset=utf-8");
        PrintWriter out = response.getWriter();
        out.write(JSON.toJSONString(r));
        out.flush();
        out.close();
    }

}
